<style lang="scss" scoped>
	.content {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.header {
		width: 100%;
		border-bottom: 1px solid #dee2ee;
		background-color: white;
		.date {
			width: 100%;
			height:100rpx;
			padding:0 30rpx;
			
			.sbtn{
				width: 40rpx;
				height: 40rpx;
				background: #dee2ee;
				border-radius: 8rpx;
				color:#879bba;
			}
		}
		.line{
			>view{
				height: 64rpx;
			}
			.col1,.col2{
				border-right: 2rpx solid  #f5f7fa;
			}
		}
	}
	.col1{
		width:160rpx;
	}
	.col2{
		width:430rpx;
	}
	.col3{
		width:160rpx;
	}
	.lists{
		width:100%;
		
		.list{
			width: 750rpx;
			background-color: #fff;
			margin-top: 30rpx;
			padding:30rpx 0;
			>view{
				padding:20rpx;
				
			}
			.col1{
				text-align: center;
				>view{
					padding:20rpx 0;
				}
				.row1{
					border-bottom:2rpx solid  #f5f7fa;
				}
			}
			.col2{
				border-left:2rpx solid  #f5f7fa;
				border-right: 2rpx solid  #f5f7fa;
				>view{
					width:100%;
				}
				.time{
					>view{
						width:50%;
					}
					flex-wrap: wrap;
				}
				.line2{
					margin-top: 50rpx;
				}
			}
		}
		
	}
	.btn{
		width: 128rpx;
		height: 64rpx;
		background: #fffefe;
		border: 2rpx solid #409eff;
		border-radius: 34rpx;
	}
</style>

<template>
	<view class="content">
		<view class="header">
			<view class="date between-flex">
				<view class="sbtn center-flex" @click="pre()">
					<u-icon name="arrow-left"></u-icon>
				</view>
				<view>{{date}} {{day[dayIndex]}}</view>
				<view class="sbtn center-flex" @click="next()">
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="between-flex line gray">
				<view class="center-flex col1">会议室</view>
				<view class="center-flex col2">预约情况</view>
				<view class="center-flex col3">操作</view>
			</view>
		</view>
		<view class="lists">
			<view class="list between-flex" v-for="item,index in list" :key="index">
				<view class=" colum-flex col1 gray">
					<view class="row1 f28  bold">{{item.name}}</view>
					<view class="row2 f24">{{item.devices | devices}}</view>
				</view>
				<view class=" colum-flex col2">
					<view class="time textColor flex f28">
						<view v-for="item2,index2 in item.busMeetingResultDtos" :key="index2">{{item2.startTime}}-{{item2.endTime}}</view>
					</view>
					<view class="line2 f28" v-for="item2,index2 in item.busMeetingResultDtos" :key="index2">
						<view>{{item2.startTime}}-{{item2.endTime}}</view>
						<view class="gray">{{item2.createUserName}} {{item2.createUserPhone}}</view>
					</view>
					
				</view>
				<view class=" colum-flex col3">
					<view class="btn center-flex blue f28" @click="$go(PagesHuiYiRouterConfig.Reserve+'?id='+item.id+'&date='+date)">预定</view>
					<view class="f24 gray m-top10">容纳{{item.peopleNumber}}人</view>
				</view>
			</view>
		</view>
		<view v-if="empty" style="position: fixed;top:40%;left:50%;transform: translateX(-50%);">
			<u-empty text="暂无列表"></u-empty>
		
		</view>
	</view>
</template>

<script>
	import PagesHuiYiRouterConfig from  '@/pagesHuiyi/routerConfig.js'
	export default {
		data() {
			return {
				PagesHuiYiRouterConfig,
				head: this.$head,
				today:'',
				date:'',
				day:['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
				dayIndex:0,
				list:[],
				empty:false
			}
		},
		onShow() {
			var time=new Date().getTime()
			this.today=this.getDate(time)
			this.date=this.getDate(time)
			this.getlist()
		},
		methods: {
			getlist(){
				this.$pop.ajaxPost('/bus/weChatMeeting/list',{
					time:this.date
				}).then(res=>{
					this.list=res.body
					if(this.list.length==0){
						this.empty=true
					}else{
						this.empty=false
					}
				})
			},
			pre(){
				if(this.today==this.date){
					return
				}
				var time=new Date(this.date).getTime()
				time-=86400000
				this.date=this.getDate(time)
				this.getlist()
				
			},
			next(){
				var time=new Date(this.date).getTime()
				time+=86400000
				this.date=this.getDate(time)
				this.getlist()
			},
			getDate(time){
				var date = new Date(time) ;
				this.dayIndex=date.getDay();
				var seperator1 = "-";
				var seperator2 = ":";
				var month = date.getMonth() + 1;
				var strDate = date.getDate();
				var hour = date.getHours()
				var min = date.getMinutes()
				month < 10 ? month = '0' + month : ''
				strDate < 10 ? strDate = '0' + strDate : ''
				hour < 10 ? hour = '0' + hour : ''
				min < 10 ? min = '0' + min : ''
				var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate ;
				return currentdate;
			},
			

		}
	}
</script>
